//
//  KKLiveChatEmotionManager.m
//  KKLiveDemo
//
//  Created by leo on 2017/7/29.
//  Copyright © 2017年 leo. All rights reserved.
//

#import "KKLiveChatEmotionManager.h"

@implementation KKLiveChatEmotionManager

+ (instancetype)manager {
    static KKLiveChatEmotionManager *manager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [KKLiveChatEmotionManager new];
    });
    return manager;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        
        _arr_emoticonTitle = @[@"/呲牙", @"/吐舌", @"/流汗", @"/偷笑", @"/再见", @"/敲打", @"/擦汗", @"/猪头", @"/玫瑰", @"/流泪", @"/大哭", @"/嘘一", @"/酷一", @"/抓狂", @"/委屈",@"/便便", @"/炸弹", @"/菜刀", @"/可爱", @"/色一", @"/害羞", @"/得意", @"/呕吐", @"/微笑", @"/发怒", @"/尴尬", @"/惊恐", @"/冷汗", @"/爱心", @"/示爱", @"/白眼", @"/傲慢", @"/难过", @"/惊讶", @"/疑问", @"/睡觉",@"/亲亲", @"/憨笑", @"/爱情", @"/衰一", @"/撇嘴", @"/阴险", @"/发奋", @"/发呆", @"/右哼", @"/拥抱", @"/坏笑", @"/飞吻", @"/鄙视", @"/晕一", @"/大兵", @"/可怜", @"/强一", @"/弱一", @"/握手", @"/胜利", @"/抱拳",@"/凋谢", @"/米饭", @"/蛋糕", @"/西瓜", @"/啤酒", @"/甲虫", @"/勾引", @"/好的", @"/爱你", @"/咖啡",  @"/月亮",  @"/刀一", @"/发抖", @"/差劲", @"/拳头", @"/心碎", @"/太阳", @"/礼物", @"/足球",@"/骷髅", @"/挥手", @"/闪电", @"/饥饿", @"/犯困", @"/大骂", @"/折磨", @"/抠鼻", @"/鼓掌", @"/糗大", @"/左哼", @"/哈欠", @"/快哭", @"/要哭", @"/篮球", @"/乒乓", @"/不行", @"/跳跳", @"/怄火", @"/转圈", @"/磕头",@"/回头", @"/跳绳", @"/激动", @"/街舞", @"/献吻", @"/左转", @"/右转", @"/闭嘴",@"/双喜", @"/鞭炮", @"/灯笼", @"/发财", @"/唱歌", @"/购物", @"/邮件", @"/帅棋", @"/喝彩", @"/祈祷", @"/爆筋", @"/糖果", @"/奶瓶", @"/面条", @"/香蕉", @"/飞机", @"/汽车", @"/车头", @"/车厢",@"/车尾", @"/多云", @"/下雨", @"/钞票", @"/熊猫", @"/灯泡", @"/风车", @"/闹钟", @"/雨伞", @"/气球", @"/钻戒", @"/沙发", @"/卷纸", @"/胶囊", @"/手枪", @"/青蛙"];
        
        _arr_emoticonImageName = @[@"f_static_000", @"f_static_001", @"f_static_002",
                                   @"f_static_003", @"f_static_004", @"f_static_005", @"f_static_006", @"f007", @"f008",
                                   @"f_static_009", @"f_static_010", @"f_static_011", @"f_static_012", @"f_static_013",
                                   @"f_static_014", @"f_static_015", @"f016", @"f_static_017", @"f_static_018", @"f_static_019",
                                   @"f_static_020", @"f_static_021", @"f_static_022", @"f_static_023", @"f_static_024",
                                   @"f_static_025", @"f_static_026", @"f_static_027", @"f028", @"f_static_029", @"f_static_030",
                                   @"f_static_031", @"f032", @"f_static_033", @"f_static_034", @"f_static_035", @"f_static_036",
                                   @"f_static_037", @"f_static_038", @"f039", @"f_static_040", @"f_static_041", @"f_static_042",
                                   @"f_static_043", @"f_static_044", @"f_static_045", @"f_static_046", @"f047", @"f_static_048",
                                   @"f_static_049", @"f_static_050", @"f_static_051", @"f_static_052", @"f_static_053",
                                   @"f_static_054", @"f_static_055", @"f_static_056", @"f057", @"f058", @"f_static_059",
                                   @"f060", @"f_static_061", @"f_static_062", @"f_static_063", @"f064", @"f_static_065",
                                   @"f_static_066",  @"f068", @"f_static_070", @"f071", @"f_static_072",
                                   @"f_static_073", @"f_static_074", @"f075", @"f076", @"f_static_077", @"f078",
                                   @"f_static_079", @"f080", @"f_static_081", @"f_static_082", @"f_static_083", @"f_static_084",
                                   @"f_static_085", @"f_static_086", @"f_static_087", @"f_static_088", @"f_static_089",
                                   @"f_static_090", @"f_static_091", @"f_static_092", @"f_static_093", @"f_static_094",
                                   @"f_static_095", @"f_static_096", @"f_static_097", @"f_static_098", @"f_static_099",
                                   @"f_static_100", @"f_static_101", @"f_static_102", @"f_static_103", @"f_static_104",
                                   @"f_static_105", @"f_static_106", @"f108", @"f109", @"f110", @"f111",
                                   @"f112", @"f113", @"f114", @"f115", @"f116", @"f117", @"f118", @"f119",
                                   @"f120", @"f121", @"f122", @"f123", @"f124", @"f125", @"f126", @"f127",
                                   @"f128", @"f129", @"f130", @"f131", @"f132", @"f133", @"f134", @"f135",
                                   @"f136", @"f137", @"f138", @"f139", @"f140", @"f141", @"f142"];
        
        NSInteger gifCount = 24;
        NSMutableArray *arr_gifName = [NSMutableArray array];
        NSMutableArray *arr_gifPathName = [NSMutableArray array];
        
        for (NSInteger index = 1; index <= gifCount; index++) {
            
            NSString *imagePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"KKLiveUIImages.bundle/Gif"];
            
            NSString *imageName = index < 10 ? [NSString stringWithFormat: @"0%@",@(index)] : [NSString stringWithFormat: @"%@",@(index)];
            [arr_gifName addObject: [NSString stringWithFormat: @"%@/icon/%@.png", imagePath,imageName]];
            
            
            [arr_gifPathName addObject: [NSString stringWithFormat: @"%@/%@.gif", imagePath,imageName]];
        }
        self.arr_gifImageName = [NSArray arrayWithArray: arr_gifName];
        self.arr_gifImagePath = [NSArray arrayWithArray: arr_gifPathName];
    }
    return self;
}

//  获取聊天的表情图片
- (UIImage*)kk_chatEmoticonWithIndex:(NSInteger)index {
    
    NSString *imageName = _arr_emoticonImageName[index];
    
    NSString *imagePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"KKLiveUIImages.bundle/Face"];
    
    imagePath = [NSString stringWithFormat: @"%@/%@.png",imagePath,imageName];
    return [UIImage imageWithContentsOfFile: imagePath];
}

- (UIImage*)kk_gifEmoticonWithIndex:(NSInteger)index {
    NSString *imagePath = _arr_gifImageName[index];
    return [UIImage imageWithContentsOfFile: imagePath];
}

- (NSString*)kk_gifImagePathWithIndex:(NSInteger)index {
    return _arr_gifImagePath[index];
}

@end
